quartz: include all buttons' states in GdkEventButton.state
authorMichael Natterer <mitch@gimp.org>
Tue, 8 Nov 2011 23:25:01 +0000 (00:25 +0100)
committerMichael Natterer <mitch@gimp.org>
Tue, 8 Nov 2011 23:26:30 +0000 (00:26 +0100)
(cherry picked from commit a381e8ea62441b6715ba9bcb0e04332fd914f8b1)

gdk/quartz/gdkevents-quartz.c

index f5e100c56a9d154a44a84e195f0416b26ff29bc0..f3b090dd8d245496c84c30782c0df88a4f922e31 100644 (file)
@@ -802,9 +802,9 @@ fill_button_event (GdkWindow *window,
 {
   GdkEventType type;
   gint state;
-  gint button;
 
-  state = get_keyboard_modifiers_from_ns_event (nsevent);
+  state = get_keyboard_modifiers_from_ns_event (nsevent) |
+         _gdk_quartz_events_get_current_mouse_modifiers ();
 
   switch ([nsevent type])
     {
@@ -812,18 +812,19 @@ fill_button_event (GdkWindow *window,
     case NSRightMouseDown:
     case NSOtherMouseDown:
       type = GDK_BUTTON_PRESS;
+      state &= ~get_mouse_button_modifiers_from_ns_event (nsevent);
       break;
+
     case NSLeftMouseUp:
     case NSRightMouseUp:
     case NSOtherMouseUp:
       type = GDK_BUTTON_RELEASE;
       state |= get_mouse_button_modifiers_from_ns_event (nsevent);
       break;
+
     default:
       g_assert_not_reached ();
     }
-  
-  button = get_mouse_button_from_ns_event (nsevent);
 
   event->any.type = type;
   event->button.window = window;
@@ -834,7 +835,7 @@ fill_button_event (GdkWindow *window,
   event->button.y_root = y_root;
   /* FIXME event->axes */
   event->button.state = state;
-  event->button.button = button;
+  event->button.button = get_mouse_button_from_ns_event (nsevent);
   event->button.device = _gdk_display->core_pointer;
 }